﻿<UserControl x:Class="NthDownload.Views.MessageDialogView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:behaviors="clr-namespace:NthDownload.Common.Interactivity.Behaviors;assembly=NthDownload.Common"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             HorizontalAlignment="Center" VerticalAlignment="Center"
             mc:Ignorable="d">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock Grid.Column="1" Grid.Row="0" TextWrapping="Wrap" MinWidth="200" MaxWidth="500" MaxHeight="300" 
                   Text="{Binding Message}" TextTrimming="CharacterEllipsis" />
        
        <StackPanel Grid.ColumnSpan="2" Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,0">
            <Button x:Name="Retry" Content="Retry" Visibility="{Binding ShowRetry, Converter={StaticResource BooleanToVisiblityTrueVisible}}"
                    Margin="5,0,0,0">
                <i:Interaction.Behaviors>
                    <behaviors:FocusOnLoad IsEnabled="{Binding FocusRetry}" />
                </i:Interaction.Behaviors>
            </Button>
            <Button x:Name="Yes" Content="Yes" Visibility="{Binding ShowYes, Converter={StaticResource BooleanToVisiblityTrueVisible}}"
                    Margin="5,0,0,0">
                <i:Interaction.Behaviors>
                    <behaviors:FocusOnLoad IsEnabled="{Binding FocusYes}" />
                </i:Interaction.Behaviors>
            </Button>            
            <Button x:Name="Ok" Content="Ok" Visibility="{Binding ShowOk, Converter={StaticResource BooleanToVisiblityTrueVisible}}"
                    Margin="5,0,0,0">
                <i:Interaction.Behaviors>
                    <behaviors:FocusOnLoad IsEnabled="{Binding FocusOk}" />
                </i:Interaction.Behaviors>
            </Button>
            <Button x:Name="No" Content="No" Visibility="{Binding ShowNo, Converter={StaticResource BooleanToVisiblityTrueVisible}}"
                    Margin="5,0,0,0">
                <i:Interaction.Behaviors>
                    <behaviors:FocusOnLoad IsEnabled="{Binding FocusNo}" />
                </i:Interaction.Behaviors>
            </Button>
            <Button x:Name="Cancel" Content="Cancel" Visibility="{Binding ShowCancel, Converter={StaticResource BooleanToVisiblityTrueVisible}}"
                    Margin="5,0,0,0">
                <i:Interaction.Behaviors>
                    <behaviors:FocusOnLoad IsEnabled="{Binding FocusCancel}" />
                </i:Interaction.Behaviors>
            </Button>
        </StackPanel>
    </Grid>
</UserControl>
